import java.awt.event.ActionListener;
import java.rmi.Naming;
import java.rmi.RemoteException;
-import java.util.Date;
import java.util.Enumeration;
import java.util.Vector;
import javax.swing.table.DefaultTableModel;
import common.BookingInterface;
-import common.OfferInterface;
+
import configuration.___IntNames;
import domain.Booking;
import domain.Offer;
lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 27));
lblNewLabel.setBounds(23, 41, 536, 33);
contentPane.add(lblNewLabel);
- if (bookings.isEmpty())
- lblNewLabel
- .setText("There are not bookings to be confirmed or denied");
- else
- lblNewLabel.setText("List of bookings:");
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(new Rectangle(45, 305, 320, 116));
scrollPane.setBounds(23, 113, 536, 271);
} catch (RemoteException e1) {
e1.printStackTrace();
}
+ contentPane.setVisible(false);
+
}
}
} catch (RemoteException e) {
e.printStackTrace();
}
+ ((DefaultTableModel) table.getModel()).removeRow(table
+ .getSelectedRow());
bookings.remove(book);
}
}
});
+ if (bookings.isEmpty())
+ lblNewLabel
+ .setText("There are not bookings to be confirmed or denied");
+ else {
+ lblNewLabel.setText("List of bookings:");
+ if (this.bookings.get(0).getOffer().isBooked()) {
+ btnDenyAddition.setEnabled(false);
+ btnNewButton.setEnabled(false);
+ }
+ }
+
btnDenyAddition.setBounds(390, 395, 169, 25);
contentPane.add(btnDenyAddition);
*/
private static final long serialVersionUID = 1L;
- public int daysBetween(Date d1, Date d2) {
- return (int) ((d2.getTime() - d1.getTime()) / (1000 * 60 * 60 * 24));
- }
-
@Override
public Component getTableCellRendererComponent(JTable table,
Object value, boolean isSelected, boolean hasFocus,
super.getTableCellRendererComponent(table, value, isSelected,
hasFocus, row, col);
- Date bookDay = (Date) table.getModel().getValueAt(row, 1);
- Date currentDay = new java.util.Date(System.currentTimeMillis());
-
- if (daysBetween(bookDay, currentDay) > 3) {
+ if (!bookings.get(row).getOffer().isBooked()) {
setBackground(Color.RED);
setForeground(Color.BLACK);
} else {